package com.fakesmoker.project.service.impl.inner;/**
 * @program: springboot-init-old-master
 * @author: lcy
 * @create: 2025-02-19 16:03
 */

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fakesmoker.apicommon.model.entity.User;
import com.fakesmoker.apicommon.service.InnerUserService;
import com.fakesmoker.project.common.ErrorCode;
import com.fakesmoker.project.exception.BusinessException;
import com.fakesmoker.project.mapper.UserMapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/**
 2025/2/19,
 */

@DubboService
public class InnerUserServiceImpl implements InnerUserService {

    @Resource
    private UserMapper userMapper;


    @Override
    public User getInvokeUser(String accessKey) {

        if (accessKey == null || StringUtils.isAnyBlank(accessKey)) {
            throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数为空");
        }

        QueryWrapper<User> queryWrapper = new QueryWrapper<User>();
        queryWrapper.eq("accessKey", accessKey);

        return userMapper.selectOne(queryWrapper);
    }
}
